﻿// (c) Copyright Microsoft Corporation.
// This source is subject to [###LICENSE_NAME###].
// Please see [###LICENSE_LINK###] for details.
// All other rights reserved.


namespace EnsureWeb.Controls
{
    /// <summary>
    /// Factory for build timeline view.
    /// </summary>
    public sealed class TimeViewFactory
    {
        /// <summary>
        /// Initializes a new instance of the TimeViewFactory class.
        /// </summary>
        private TimeViewFactory()
        {
        }

        /// <summary>
        /// Create a new TimeView based on the scale.
        /// </summary>
        /// <param name="timeline">Parent timeline control.</param>
        /// <param name="scale">Time scale.</param>
        /// <returns>A new timeline view.</returns>
        public static TimeView GetTimeView(MultiScaleTimeline timeline, TimelineScale scale)
        {
            TimeView view = null;

            switch (scale)
            {
                case TimelineScale.Year:
                    view = new YearView(timeline);
                    break;

                case TimelineScale.Month:
                    view = new MonthView(timeline);
                    break;

                case TimelineScale.Decade:
                    view = new DecadeView(timeline);
                    break;

                case TimelineScale.Day:
                    view = new DayView(timeline);
                    break;

                case TimelineScale.Hour:
                    view = new HourView(timeline);
                    break;

                case TimelineScale.Minute:
                    view = new MinuteView(timeline);
                    break;

                case TimelineScale.Second:
                    view = new SecondView(timeline);
                    break;
            }

            return view;
        }
    }
}
